#pragma once

#include <base.h>

typedef struct  {
	size_t size;
	uint8_t data[0];
} bitmap_t;

#define BITMAP_PHYSIZE(size) (sizeof( bitmap_t) + ((size) >> 3) + !!((size) & 7))

void bitmap_set( bitmap_t *bitmap, size_t index, size_t count, bool value);

/**
 * @brief 检查`bitmap`在指定区域内是否有位被设置为`value`
 */
bool bitmap_is_any_set_as( bitmap_t *bitmap, size_t index, size_t count, bool value);

/**
 * @brief 检查`bitmap`在指定区域内是否全部位都被设置为`value`
 */
bool bitmap_is_all_set_as( bitmap_t *bitmap, size_t index, size_t count, bool value);